* Merges restricted ANES occupations codes with the public use data.


*****************************************************************************
* Open public ANES data.													*
*****************************************************************************

set more off
use "anes_timeseries_cdf.dta", clear

* Variables required for the merge.
gen year = VCF0004
gen caseid = VCF0006


*****************************************************************************
* Merge restricted ANES occupation codes.									*
*****************************************************************************

*****************************************************************************
* The excel files including respondent occupations are stored in a password *
* protected folder; the folder must be mounted before running the code.		*
*****************************************************************************

foreach yr of numlist 1986(2)2000 2004 {
merge 1:1 caseid year using /Volumes/ANES_OccupationCodes/ANES_Restricted_Occ_`yr'.dta, nogen update
}
*

*****************************************************************************
* Use occupation code crosswalk to create 2010 occupation codes from 		*
* earlier years.															*
*****************************************************************************

* Placeholder variable for multiple merges.
gen occ10 = .

* Separate merges for each set of occupation codes.
merge m:1 occ1980 using "occ_crosswalk_1980.dta", nogen update
merge m:1 occ1990 using "occ_crosswalk_1990.dta", nogen update
merge m:1 occ2000 using "occ_crosswalk_2000.dta", nogen update

